/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
}

/* Responsive height management for iframe vs full page */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

/* Full page mode detection */
@media (min-height: 500px) {
    .game-container {
        height: 90vh;
        min-height: 450px;
    }
}

/* Configuration Panel */
.config-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
    max-width: 90%;
}

.config-panel.show {
    display: block;
}

/* Control Panel */
.control-panel {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

/* Button Styles - Removed .btn-primary and .btn-secondary styles as they are no longer needed */
.btn-small {
    padding: 8px 16px;
    border: none;
    border-radius: 25px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    white-space: nowrap;
    min-height: 36px;
    background: #666;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-small:hover, .btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn-small:active, .btn-icon:active {
    transform: translateY(0);
}

/* Timer Display */
.timer-display {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.9);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Progress Ring */
.progress-ring {
    position: absolute;
    top: 60px;
    right: 15px;
    z-index: 10;
    text-align: center;
}

.progress-circle {
    transform: rotate(-90deg);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: bold;
    color: #333;
}

/* Card Container */
.card-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Scratch Card */
.scratch-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 300px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scratch-card:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}

.scratch-card:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* Mascot */
.mascot {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 30px;
    z-index: 5;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Canvas */
#scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 3;
}

/* Result Layer */
.result-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1;
}

.prize-content {
    text-align: center;
    color: white;
    animation: prizeGlow 2s ease-in-out infinite alternate;
}

.prize-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.prize-text {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.prize-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

@keyframes prizeGlow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
    to { text-shadow: 2px 2px 20px rgba(255,255,255,0.8); }
}

/* Scratch Instruction */
.scratch-instruction {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #silver, #lightgray);
    z-index: 2;
    text-align: center;
    padding: 20px;
}

.scratch-instruction h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: sparkle 1.5s ease-in-out infinite;
}

.scratch-instruction p {
    font-size: 16px;
    color: #666;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Results Panel */
.results-panel {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.results-panel h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
    text-align: center;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    font-size: 12px;
}

.result-prize {
    font-weight: bold;
}

.result-time {
    color: #666;
    font-size: 10px;
}

.no-results {
    text-align: center;
    color: #666;
    font-size: 12px;
    padding: 10px;
}

/* Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #FFD700;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tooltip.show {
    opacity: 1;
}

/* High Contrast Mode */
.high-contrast {
    filter: contrast(150%) brightness(120%);
}

.high-contrast .scratch-card {
    border: 3px solid #000;
}

/* Removed high contrast styles for removed buttons */

/* Mobile Optimizations */
@media (max-width: 480px) {
    .game-container {
        padding: 5px;
        gap: 8px;
    }
    
    .scratch-card {
        max-width: 100%;
        height: 250px;
    }
    
    .control-panel {
        gap: 8px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .scratch-instruction h2 {
        font-size: 24px;
    }
    
    .prize-text {
        font-size: 20px;
    }
    
    .prize-icon {
        font-size: 50px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .scratch-card:hover {
        transform: none;
    }
    
    .btn-small:hover, .btn-icon:hover {
        transform: none;
    }
}